import UserAPI from '@/api/user'
import type { UserQuery } from '@/api/user/model'
import type { IContentConfig } from '@/components/PageContent/index.vue'

const contentConfig: IContentConfig<UserQuery> = {
  pageName: 'sys:user',
  table: {
    highlightCurrentRow: true,
  },
  indexAction(params) {
    if ('createAt' in params) {
      const createAt = params.createAt as string[]
      params.startTime = createAt[0]
      params.endTime = createAt[1]
      delete params.createAt
    }
    return UserAPI.getPage(params)
  },
  deleteAction: UserAPI.deleteByIds,
  exportAction: UserAPI.export,
  pk: 'id',
  toolbar: [
  ],
  cols: [
    {
      prop: 'nickname',
      label: '优惠券',
      align: 'center',
    },
    {
      prop: 'nickname',
      label: '类型',
      align: 'center',
    },
    {
      prop: 'nickname',
      label: '适用用户',
      align: 'center',
    },
    {
      prop: 'nickname',
      label: '优惠内容',
      align: 'center',
    },
    {
      prop: 'nickname',
      label: '发放/使用时间',
      align: 'center',
    },
    {
      prop: 'nickname',
      label: '发放量',
      align: 'center',
    },
  ],
}

export default contentConfig
